//分享朋友圈
$(".share_cover").click(function () {
    $(this).hide();
})

$(".share").click(function () {
    $(".share_cover").show();
    $(".text_area").click(function () {
        $(this).children().css("textDecoration", "none").parent().parent().hide();
    })
})
//轮播图
var swiper_header = new Swiper('.swiper_header', {
    autoplay: true,
    loop: true,
    pagination: {
        el: '.swiper-pagination',
        clickable: true,
        bulletClass: 'my-bullet',
        bulletActiveClass: 'my-bullet-active',
    },
})
//渲染数据
function reg_data(st, ed, el) {
    $.ajax({
        url: "../php/laikuan.php",
        dataType: "json",
        type: "post",
        data: {
            " _start": st,
            "_end": ed
        },
        success: function (res) {
            var _html = "";
            for (var i = 0; i < res.length; i++) {
                _html += ` <li class="pr">
                        <a>
                            <img data-echo="${res[i].img_src}"
                                src="https://dss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3899735244,1133845447&fm=26&gp=0.jpg"
                                lazy="loaded">
                            <div class="cover-box pa">
                                <div class="title">${res[i].name}</div>
                                <div class="intro">${res[i].intro}</div>
                                <div class="sport_time pa">${res[i].time}</div>
                            </div>
                        </a>
                    </li>`;
            }
            $(el).html(_html);
        }
    })

}
reg_data(1, 5, ".pro_area");
reg_data(6, 11, ".reduce_area");
reg_data(12, 24, ".full_minus_area");
reg_data(25, 28, ".discount_area");
reg_data(29, 31, ".brand_choice_area");
//
var mybs = new BScroll('.container', {
    probeType: 3,
})

mybs.on('pullingUp', function () {
    bs.finishPullUp();
    bs.refresh();
})
mybs.on('scroll', function () {
    echo.init({
        offset:-200,
    })
    $('.hot_basket').each(function (i) {
        var oftop = $(this).offset().top;
        if (oftop <= 400) {
            $('.header_nav li').eq(i).addClass("active").children().show().parent().siblings().removeClass("active").children().hide();
        }
    })
})
$('.header_nav>ul>li').each(function () {
    $(this).append("<div class='bar'></div>");
})

$('.header_nav li').click(function () {
    $(this).addClass("active").children().show().parent().siblings().removeClass("active").children().hide();
    var el = $('.hot_basket').eq($(this).index()).get(0);
    mybs.scrollToElement(el);
})

//头部x号
$(".sign .iconshenglve").click(function () {
    $(this).hide().next().show();
    $(".header_nav nav").show();
})
$(".sign .iconclose").click(function () {
    $(this).hide().prev().show();
    $(".header_nav nav").hide();
})

// 跳转
$('.header_nav .pa li').eq(0).click(function(){
    location.href="../index.html";
    console.log(1212)
})
$('.header_nav .pa li').eq(1).click(function(){
    location.href="../html/sousuo.html";
})
$('.header_nav .pa li').eq(2).click(function(){
    location.href="../html/classify.html";
})
$('.header_nav .pa li').eq(3).click(function(){
    location.href="../html/car.html";
})
$('.header_nav .pa li').eq(4).click(function(){
    location.href="../html/personal.html";
})